﻿using DAL;
using DAL.JSGN;
using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BLL.JSGN
{
    public class AttachmentBLL
    {
        private readonly DataContext _dataContext;
        private readonly AttachmentDAL _attachmentDAL;

        public AttachmentBLL()
        {
            _dataContext = new DataContext();
            _attachmentDAL = new AttachmentDAL(_dataContext);
        }

        public async Task<AttachmentModel> GetAsync(Guid id)
        {
            var entity = await _attachmentDAL.GetAsync(id);
            if (entity == null) return null;
            return new AttachmentModel() { AttachmentId = entity.AttachmentId, FileName = entity.FileName, Extension = entity.Extension, MediaType = entity.MediaType, FileStream = entity.FileStream };
        }
    }
}
